import React from "react";
import "@styles/components/ButtonBar.scss";
type IProps = {
    clickEdit?:()=>void;
    clickCancel?:()=>void;
    clickConfirm?:()=>void;
    buttonList:Array<{
        type:string,
        name:string,
    }>
}
class ButtonBar extends React.Component<IProps>{
    constructor(props:any){
        super(props);
    }

    render(){
        return(
            <div className="ButtonBar-Wrapper clear">
                {this.props.buttonList.map((item:any,index:number)=>{
                    if (item.type==='edit' && this.props.clickEdit){
                        return (<div className="button-item Button " onClick={this.props.clickEdit.bind(this)}>
                            编辑
                        </div>)
                    }
                    if (item.type==='cancel' && this.props.clickCancel){
                        return (<div className="button-item Button " onClick={this.props.clickCancel.bind(this)}>
                            取消
                        </div>)
                    }
                    if (item.type==='confirm' && this.props.clickConfirm){
                        return (<div className="button-item Button " onClick={this.props.clickConfirm.bind(this)}>
                            确认
                        </div>)
                    }

                })}
               
            </div>
            
        )
    }

}
export default ButtonBar;